package com.kaha.cropimage;

import android.graphics.Bitmap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.kaha.cropimage.view.CropImageView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        cropImageView = findViewById(R.id.crop_image);

    }


    CropImageView cropImageView;

    public void crop(View view) {
        //获取裁剪的图片
        Bitmap cropBitMap = cropImageView.getCroppedImage();
        cropImageView.setImageBitmap(cropBitMap);
    }

    public void click916(View view) {
        cropImageView.setAspectRatio(9, 16);
    }

    public void click169(View view) {
        cropImageView.setAspectRatio(16, 9);
    }

    public void click11(View view) {
        cropImageView.setAspectRatio(1, 1);
    }

    public void click43(View view) {
        cropImageView.setAspectRatio(4, 3);
    }

    public void click34(View view) {
        cropImageView.setAspectRatio(3, 4);
    }

    public void showCropBox(View view) {
        cropImageView.setShowCropBox(true);
    }

    public void hideCropBox(View view) {
        cropImageView.setShowCropBox(false);
    }
}
